home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung 2 / Power-Programmierung CD 2 (Tewi)(1994).iso / gnu / djgpp / contrib / dvx / inc / x11 / initiali.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-07-15  |  9.7 KB  |  332 lines

  1. /* $XConsortium: InitialI.h,v 1.35 90/08/31 08:13:11 swick Exp $ */
  2.  
  3. /***********************************************************
  4. Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
  5. and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
  6.  
  7.                         All Rights Reserved
  8.  
  9. Permission to use, copy, modify, and distribute this software and its 
  10. documentation for any purpose and without fee is hereby granted, 
  11. provided that the above copyright notice appear in all copies and that
  12. both that copyright notice and this permission notice appear in 
  13. supporting documentation, and that the names of Digital or MIT not be
  14. used in advertising or publicity pertaining to distribution of the
  15. software without specific, written prior permission.  
  16.  
  17. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  18. ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  19. DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  20. ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  21. WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  22. ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  23. SOFTWARE.
  24.  
  25. ******************************************************************/
  26.  
  27. /****************************************************************
  28.  *
  29.  * Displays
  30.  *
  31.  ****************************************************************/
  32.  
  33. #include <sys/param.h>                /* to get MAXPATHLEN */
  34. #ifndef MAXPATHLEN
  35. #define MAXPATHLEN 256
  36. #endif
  37.  
  38. #ifndef MAX
  39. #define MAX(a,b) (((a) > (b)) ? (a) : (b))
  40. #endif
  41.  
  42. #ifndef MIN
  43. #define MIN(a,b) (((a) < (b)) ? (a) : (b))
  44. #endif
  45.  
  46. #ifdef MSDOS /* POHC 90/10/22 */
  47. #include <stdio.h>
  48. #ifndef NOFILE
  49. #ifdef FOPEN_MAX
  50. #define NOFILE FOPEN_MAX
  51. #else /* FOPEN_MAX */
  52. #define NOFILE 20
  53. #endif /* FOPEN_MAX */
  54. #endif /* NOFILE */
  55. #endif /* MSDOS */
  56.  
  57. #include <X11/fd.h> /* Was "fd.h". POHC 90/12/18 */
  58.  
  59. typedef struct _TimerEventRec {
  60.         struct timeval        te_timer_value;
  61.     struct _TimerEventRec *te_next;
  62.     Display              *te_dpy;
  63.     XtTimerCallbackProc   te_proc;
  64.     XtAppContext          app;
  65.     XtPointer          te_closure;
  66. } TimerEventRec;
  67.  
  68. typedef struct _InputEvent {
  69.     XtInputCallbackProc   ie_proc;
  70.     XtPointer          ie_closure;
  71.     struct _InputEvent    *ie_next;
  72.     struct _InputEvent    *ie_oq;
  73.     XtAppContext          app;
  74.     int              ie_source;
  75.     XtInputMask          ie_condition;
  76. } InputEvent;
  77.  
  78. typedef struct _WorkProcRec {
  79.     XtWorkProc proc;
  80.     XtPointer closure;
  81.     struct _WorkProcRec *next;
  82.     XtAppContext app;
  83. } WorkProcRec;
  84.  
  85.  
  86. typedef struct 
  87. _FdStruct { /* Added Tag. POHC 91/01/16 */
  88.       Fd_set rmask;
  89.     Fd_set wmask;
  90.     Fd_set emask;
  91.     int    nfds;
  92.     int    count;
  93. } FdStruct;
  94.  
  95. typedef struct _ProcessContextRec {
  96.     XtAppContext    defaultAppContext;
  97.     XtAppContext    appContextList;
  98.     ConverterTable    globalConverterTable;
  99. } ProcessContextRec, *ProcessContext;
  100.  
  101. typedef struct _Heap { /* Added Tag. POHC 91/01/16 */
  102.     char*    start;
  103.     char*    current;
  104.     int        bytes_remaining;
  105. } Heap;
  106.  
  107. typedef struct _DestroyRec DestroyRec;
  108.  
  109. typedef struct _XtAppStruct {
  110.     XtAppContext next;        /* link to next app in process context */
  111.     ProcessContext process;    /* back pointer to our process context */
  112.     CallbackList destroy_callbacks;
  113.     Display **list;
  114.     TimerEventRec *timerQueue;
  115.     WorkProcRec *workQueue;
  116.     InputEvent **input_list;
  117.     InputEvent *outstandingQueue;
  118.     XrmDatabase errorDB;
  119.     XtErrorMsgHandler errorMsgHandler, warningMsgHandler;
  120.     XtErrorHandler errorHandler, warningHandler;
  121.     struct _ActionListRec *action_table;
  122.     ConverterTable converterTable;
  123.     unsigned long selectionTimeout;
  124.     FdStruct fds;
  125.     short count;            /* num of assigned entries in list */
  126.     short max;                /* allocate size of list */
  127.     short last;
  128.     Boolean sync, being_destroyed, error_inited;
  129. #ifndef NO_IDENTIFY_WINDOWS
  130.     Boolean identify_windows;        /* debugging hack */
  131. #endif
  132.     Heap heap;
  133.     String * fallback_resources;    /* Set by XtAppSetFallbackResources. */
  134.     struct _ActionHookRec* action_hook_list;
  135.     int destroy_list_size;        /* state data for 2-phase destroy */
  136.     int destroy_count;
  137.     int dispatch_level;
  138.     DestroyRec* destroy_list;
  139.     Widget in_phase2_destroy;
  140. } XtAppStruct;
  141.  
  142. extern char* _XtHeapAlloc(
  143. #if NeedFunctionPrototypes
  144.     Heap*    /* heap */,
  145.     Cardinal    /* size */
  146. #endif
  147. );
  148.  
  149. extern void _XtSetDefaultErrorHandlers(
  150. #if NeedFunctionPrototypes
  151.     XtErrorMsgHandler*    /* errMsg */,
  152.     XtErrorMsgHandler*    /* warnMsg */,
  153.     XtErrorHandler*    /* err */,
  154.     XtErrorHandler*    /* warn */
  155. #endif
  156. );
  157.  
  158. extern void _XtSetDefaultSelectionTimeout(
  159. #if NeedFunctionPrototypes
  160.     unsigned long* /* timeout */
  161. #endif
  162. );
  163.  
  164. extern void _XtSetDefaultConverterTable(
  165. #if NeedFunctionPrototypes
  166.     ConverterTable* /* table */
  167. #endif
  168. );
  169.  
  170. extern void _XtFreeConverterTable(
  171. #if NeedFunctionPrototypes
  172.     ConverterTable /* table */
  173. #endif
  174. );
  175.  
  176. extern XtAppContext _XtDefaultAppContext(
  177. #if NeedFunctionPrototypes
  178.     void
  179. #endif
  180. );
  181.  
  182. extern ProcessContext _XtGetProcessContext(
  183. #if NeedFunctionPrototypes
  184.     void
  185. #endif
  186. );
  187.  
  188. extern void _XtDestroyAppContexts(
  189. #if NeedFunctionPrototypes
  190.     void
  191. #endif
  192. );
  193.  
  194. extern void _XtCloseDisplays(
  195. #if NeedFunctionPrototypes
  196.     void
  197. #endif
  198. );
  199.  
  200. extern int _XtAppDestroyCount;
  201. extern int _XtDpyDestroyCount;
  202.  
  203. extern int _XtwaitForSomething(
  204. #if NeedFunctionPrototypes
  205. #if NeedWidePrototypes
  206.     /* Boolean */ int    /* ignoreTimers */,
  207.     /* Boolean */ int    /* ignoreInputs */,
  208.     /* Boolean */ int    /* ignoreEvents */,
  209.     /* Boolean */ int    /* block */,
  210. #else
  211.     Boolean         /* ignoreTimers */,
  212.     Boolean         /* ignoreInputs */,
  213.     Boolean         /* ignoreEvents */,
  214.     Boolean         /* block */,
  215. #endif /*NeedWidePrototypes*/
  216.     unsigned long*    /* howlong */,
  217.     XtAppContext     /* app */
  218. #endif
  219. );
  220.  
  221. typedef struct _ScreenDrawablesRec { /* support for XtGetGC */ /* Added Tag. POHC 91/01/16 */
  222.     Screen* screen;        /* root to which drawables apply */
  223.     Drawable* drawables;    /* list of drawables, indexed by depth */
  224.     Cardinal drawable_count;    /* num entries in above list */
  225. } ScreenDrawablesRec, *ScreenDrawables;
  226.  
  227. typedef struct _XtPerDisplayStruct {
  228.     CallbackList destroy_callbacks;
  229.     Region region;
  230.     XtCaseProc defaultCaseConverter;
  231.     XtKeyProc defaultKeycodeTranslator;
  232.     XtAppContext appContext;
  233.     KeySym *keysyms;                   /* keycode to keysym table */
  234.     int keysyms_per_keycode;           /* number of keysyms for each keycode*/
  235.     int min_keycode, max_keycode;      /* range of keycodes */
  236.     KeySym *modKeysyms;                /* keysym values for modToKeysysm */
  237.     ModToKeysymTable *modsToKeysyms;   /* modifiers to Keysysms index table*/
  238.     unsigned char isModifier[32];      /* key-is-modifier-p bit table */
  239.     KeySym lock_meaning;           /* Lock modifier meaning */
  240.     Modifiers mode_switch;           /* keyboard group modifiers */
  241.     Boolean being_destroyed;
  242.     Boolean rv;                   /* reverse_video resource */
  243.     XrmName name;               /* resolved app name */
  244.     XrmClass class;               /* application class */
  245.     Heap heap;
  246.     struct _GCrec *GClist;           /* support for XtGetGC */
  247.     ScreenDrawables drawable_tab;      /* ditto for XtGetGC */
  248.     String language;               /* XPG language string */
  249.     Atom xa_wm_colormap_windows;       /* the WM_COLORMAP_WINDOWS atom.
  250.                       this is currently only used in 
  251.                       XtSetColormapWindows. */
  252.     Time last_timestamp;           /* from last event dispatched */
  253.     int multi_click_time;           /* for XtSetMultiClickTime */
  254.     struct _TMContext* tm_context;     /* for XtGetActionKeysym */
  255.     CallbackList mapping_callbacks;    /* special case for TM */
  256.     XtPerDisplayInputRec pdi;           /* state for modal grabs & kbd focus */
  257. } XtPerDisplayStruct, *XtPerDisplay;
  258.  
  259. typedef struct _PerDisplayTable {
  260.     Display *dpy;
  261.     XtPerDisplayStruct perDpy;
  262.     struct _PerDisplayTable *next;
  263. } PerDisplayTable, *PerDisplayTablePtr;
  264.  
  265. extern PerDisplayTablePtr _XtperDisplayList;
  266.  
  267. extern XtPerDisplay _XtSortPerDisplayList(
  268. #if NeedFunctionPrototypes
  269.     Display* /* dpy */
  270. #endif
  271. );
  272.  
  273. /*
  274. extern XtPerDisplay _XtGetPerDisplay( Display* );
  275. extern XtPerDisplayInputRec* _XtGetPerDisplayInput( Display* );
  276. */
  277.  
  278. #ifdef DEBUG
  279. #define _XtGetPerDisplay(display) \
  280.     ((_XtperDisplayList != NULL && (_XtperDisplayList->dpy == (display))) \
  281.      ? &_XtperDisplayList->perDpy \
  282.      : _XtSortPerDisplayList(display))
  283. #define _XtGetPerDisplayInput(display) \
  284.     ((_XtperDisplayList != NULL && (_XtperDisplayList->dpy == (display))) \
  285.      ? &_XtperDisplayList->perDpy.pdi \
  286.      : &_XtSortPerDisplayList(display)->pdi)
  287. #else
  288. #define _XtGetPerDisplay(display) \
  289.     ((_XtperDisplayList->dpy == (display)) \
  290.      ? &_XtperDisplayList->perDpy \
  291.      : _XtSortPerDisplayList(display))
  292. #define _XtGetPerDisplayInput(display) \
  293.     ((_XtperDisplayList->dpy == (display)) \
  294.      ? &_XtperDisplayList->perDpy.pdi \
  295.      : &_XtSortPerDisplayList(display)->pdi)
  296. #endif /*DEBUG*/
  297.  
  298. extern void _XtDisplayInitialize(
  299. #if NeedFunctionPrototypes
  300.     Display*        /* dpy */,
  301.     XtPerDisplay    /* pd */,
  302.     String        /* name */,
  303.     String        /* classname */,
  304.     XrmOptionDescRec*    /* urlist */,
  305.     Cardinal         /* num_urs */,
  306.     Cardinal*        /* argc */,
  307.     char**         /* argv */
  308. #endif
  309. );
  310.  
  311. extern void _XtCacheFlushTag(
  312. #if NeedFunctionPrototypes
  313.     XtAppContext /* app */,
  314.     XtPointer     /* tag */
  315. #endif
  316. );
  317.  
  318. extern void _XtFreeActions(
  319. #if NeedFunctionPrototypes
  320.     struct _ActionListRec* /* action_table */
  321. #endif
  322. );
  323.  
  324. extern void _XtDoPhase2Destroy(
  325. #if NeedFunctionPrototypes
  326.     XtAppContext /* app */,
  327.     int         /* dispatch_level */
  328. #endif
  329. );
  330.  
  331. #define _XtSafeToDestroy(app) ((app)->dispatch_level == 0)
  332.